const mongoose = require('../config/db/mongo');
const moment = require('moment');
const Schema = mongoose.Schema;
const schemaOptions = {
        versionKey: false
    }
    /**
     *
     *    Role 所有用户都有一个Role 根据Role不同给予不同的权限
     *
     */
const roleSchema = new Schema({

    //权限名称
    name: String, // root, 订单管理，etc
    //给予
    isDelete: Number,
    createdAt: { type: Date, default: Date.now },
    updatedAt: { type: Date },
}, schemaOptions);

// methods ====================== 提高数据库检索速度 按顺序
roleSchema.index({ name: 1 });
// create the model for users and expose it to our app
module.exports = mongoose.model('role', roleSchema, 'role');